UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eN1uS+BLBmdG03Q9LH56LFdUX+TWp693cCHHjlJp0fE=' 
WHERE 
  key_id = 'bc4f1c2b5a18fcf8ab1fc2b0cae039cf5b53819527284db117033f9ac4b7acd9' 
  AND (
    token = 'eN1uS+BLBmdG03Q9LH56LFdUX+TWp693cCHHjlJp0fE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027