UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BPKPqJpG+LlZmWY6a1mQjidI2/CwDssHbKzUsfdPCb8=' 
WHERE 
  key_id = 'dc47b166c607caa69a6422aeaa3f238710bb99d99dbcfadb0c538e1626c6770f' 
  AND (
    token = 'BPKPqJpG+LlZmWY6a1mQjidI2/CwDssHbKzUsfdPCb8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027