UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sejn8bhvlLsR97PmE7ztpWHMyyGjeJn864rjRdR+yzg=' 
WHERE 
  key_id = 'c9e96286704952bddb88ea7296967791aa508444560459e61dc119a92563fc45' 
  AND (
    token = 'Sejn8bhvlLsR97PmE7ztpWHMyyGjeJn864rjRdR+yzg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039