UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nFNgmaZI34JPCvCQvhN/e/20N7IZ7Y60A9UxgqYrqu0=' 
WHERE 
  key_id = '23df79f1fc9326ea91d21d1068469faac12678c2bcc8822b528369a052ecd94d' 
  AND (
    token = 'nFNgmaZI34JPCvCQvhN/e/20N7IZ7Y60A9UxgqYrqu0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031