UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jjh4jg5ulJ2+QiKLY81VsvTv22whE99y08yAZVT9syw=' 
WHERE 
  key_id = '2e4d4098f7f75c8065ba7c3fcfcb1d2ac88b7589a0ee7861019c39763ac0b4aa' 
  AND (
    token = 'jjh4jg5ulJ2+QiKLY81VsvTv22whE99y08yAZVT9syw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024