UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SwRynW1hQhxqc6p3tPg+9g2Qx4Kq5/HO61HqyxURjRg=' 
WHERE 
  key_id = 'b146dc1b1c5fa4e3b7a118dd9016035a1472246b416772734ab56cf277c09726' 
  AND (
    token = 'SwRynW1hQhxqc6p3tPg+9g2Qx4Kq5/HO61HqyxURjRg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038