UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l9UTJg7lN85h+QNSU8U2ddynyl79F+oRBDiQpKMUS8Y=' 
WHERE 
  key_id = '9b024d6892dcb91d0c0a29464dfba1390bafb15074ac158d0f46d66eec43c986' 
  AND (
    token = 'l9UTJg7lN85h+QNSU8U2ddynyl79F+oRBDiQpKMUS8Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028